package nl.rainbowsheep.reisorg.rest.service.controller;

import nl.rainbowsheep.reisorg.rest.service.model.BurritoRole;
import nl.rainbowsheep.reisorg.rest.service.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Controller for Roles
 */
@RestController
@RequestMapping(value = "/role")
public class RoleController {

    @Autowired
    private RoleService rolService;

    @RequestMapping(value = "/getByName", method = RequestMethod.GET)
    @ResponseBody
    public BurritoRole getUserByName(@RequestParam(value = "name", required = true) String name) {
        BurritoRole rol = rolService.findByName(name);
        return rol;
    }
}
